#include <iostream>

using namespace std;

int main() {
    auto num = 600851475143;
    for (auto i = 2; i * i < num; ++i) {
        if (num % i == 0)
            cout << i << endl;
        while (num % i == 0) 
            num /= i;
    }
    if (num > 1)
        cout << num << endl; // The largest prime factor
}